﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucOrder.ascx.cs" Inherits="UserControl_ucOrder" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr>
        <td class="clsRegisterTitle">
            Đơn Đặt Hàng
        </td>
    </tr>
    <tr>
        <td style="padding: 5px 7px 5px 7px; text-align: left;">
            <table border="0" cellpadding="0" cellspacing="3" style="width: 450px">
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td style="width: 215px">
                        Từ ngày:&nbsp;
                        <asp:TextBox ID="txtFrDate" runat="server" Width="100px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtFrDate"
                            Display="Dynamic" ErrorMessage="*" ValidationGroup="grpOrder"></asp:RequiredFieldValidator><br />
                        <%--<asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="Please enter proper date"
                            ControlToValidate="txtFrDate" Type="Date" ValidationGroup="grpOrder"></asp:RangeValidator>--%>
                        <asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtFrDate"
                            Format="dd/MM/yyyy">
                        </asp:CalendarExtender>
                    </td>
                    <td style="width: 215px">
                        Đến ngày:&nbsp;
                        <asp:TextBox ID="txtToDate" runat="server" Width="100px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtToDate"
                            Display="Dynamic" ErrorMessage="*" ValidationGroup="grpOrder"></asp:RequiredFieldValidator><br />
                        <%--<asp:RangeValidator ID="RangeValidator2" runat="server" ErrorMessage="Please enter proper date"
                            ControlToValidate="txtToDate" Type="Date" ValidationGroup="grpOrder"></asp:RangeValidator>--%>
                        <asp:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txtToDate"
                            Format="dd/MM/yyyy">
                        </asp:CalendarExtender>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td>
                        <asp:Button ID="btnSubmit" runat="server" SkinID="btnSubmit" ValidationGroup="grpOrder"
                            Text="Tìm Kiếm" OnClick="btnSubmit_Click" />
                        <%--<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="txtFrDate"
                            ControlToValidate="txtToDate" ErrorMessage="Ngày không hợp lệ" Operator="GreaterThan"
                            Type="Date" ValidationGroup="grpOrder"></asp:CompareValidator>--%>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
    <tr>
        <td align="center" style="padding-top: 10px;">
            <div style="text-align: left">
                <table border="0" cellpadding="0" cellspacing="1" width="100%">
                    <tr>
                        <td>
                            <table border="0" cellpadding="0" cellspacing="1" width="100%">
                                <tr>
                                    <td>
                                        <asp:ListView runat="server" ID="lvItem" ItemPlaceholderID="groupPlaceholder" GroupItemCount="1"
                                            GroupPlaceholderID="layoutTemplate" 
                                            onselectedindexchanged="lvItem_SelectedIndexChanged">
                                            <EmptyDataTemplate>
                                                Không có đơn đặt hàng.
                                            </EmptyDataTemplate>
                                            <LayoutTemplate>
                                                <table runat="server" id="layoutTemplate" class="cs_Table" border="1" rules="all">
                                                    <tr runat="server" id="head">
                                                        <th id="Th1" runat="server" width="50px" style="text-align: center">
                                                            #
                                                        </th>
                                                        <th id="Th2" runat="server" style="text-align: center; width: 80px">
                                                            Mã Đơn Hàng
                                                        </th>
                                                        <th id="Th3" runat="server" width="80px" style="text-align: center">
                                                            Ngày Đặt
                                                        </th>
                                                        <th id="Th4" runat="server" style="text-align: center; width: 250px">
                                                            Địa Chỉ
                                                        </th>
                                                        <th id="Th5" runat="server" width="90px" style="text-align: center">
                                                            Trị Giá Đơn Hàng
                                                        </th>
                                                        <th id="Th6" runat="server" width="90px" style="text-align: right">
                                                            Phí Vận Chuyển
                                                        </th>
                                                    </tr>
                                                    <tr runat="server" id="groupPlaceholder">
                                                    </tr>
                                                </table>
                                            </LayoutTemplate>
                                            <ItemTemplate>
                                                <tr id="tr1" runat="server">
                                                    <td id="Td1" runat="server" style="text-align: center">
                                                        <asp:Label ID="lbstt" runat="server" Text='<%# Eval("row") %>'></asp:Label>
                                                    </td>
                                                    <td id="Td2" runat="server" style="text-align: center">
                                                        <asp:HyperLink ID="hyp_OrderId" runat="server" NavigateUrl='<%# "~/DetailOrder.aspx?id=" + Eval("OrderID")%>'
                                                            Text='<%# Eval("OrderID") %>'></asp:HyperLink>
                                                    </td>
                                                    <td id="Td3" runat="server" style="text-align: center">
                                                        <asp:Label ID="lbOrderDate" runat="server" Text='<%# Convert.ToDateTime(Eval("OrderDate")).ToString("dd/MM/yyyy") %>'></asp:Label>
                                                    </td>
                                                    <td id="Td5" runat="server" style="text-align: left">
                                                        <asp:Label ID="lbAddress" runat="server" Text='<%# Eval("ShipTo") %>'></asp:Label>
                                                    </td>
                                                    <td id="Td4" runat="server" style="text-align: right">
                                                        <asp:Label ID="lbTotal" runat="server" Text='<%# double.Parse(Eval("Total").ToString()).ToString("0,00.##")%>'></asp:Label>
                                                    </td>
                                                    <td id="Td6" runat="server" style="text-align: right">
                                                        <asp:Label ID="Label1" runat="server" Text='<%# Eval("DeliveryFee")%>'></asp:Label>
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:ListView>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" style="padding-top: 15px;">
                                        <asp:DataPager ID="DataPagerImages" runat="server" PagedControlID="lvItem" 
                                            PageSize="10" onprerender="DataPagerImages_PreRender">
                                            <Fields>
                                                <asp:NextPreviousPagerField ButtonType="Link" ShowFirstPageButton="False" ShowNextPageButton="False"
                                                    ShowPreviousPageButton="False" />
                                                <asp:NumericPagerField />
                                                <asp:NextPreviousPagerField ButtonType="Link" ShowLastPageButton="False" ShowNextPageButton="False"
                                                    ShowPreviousPageButton="False" />
                                            </Fields>
                                        </asp:DataPager>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </div>
        </td>
        <td>
            &nbsp;
        </td>
    </tr>
</table>
